
{
  inputs = {
    # nixpkgs.url = "https://ghproxy.com/https://github.com/NixOS/nixpkgs/archive/nixos-23.05.tar.gz";
    # nixpkgs.url = "https://ghproxy.com/https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager = {
      # url = "https://ghproxy.com/https://github.com/nix-community/home-manager/archive/master.tar.gz";
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    # nixos-generators = {
    #   url = "https://ghproxy.com/https://github.com/nix-community/nixos-generators/archive/master.tar.gz";
    #   inputs.nixpkgs.follows = "nixpkgs";
    # };
    vscode-server.url = "https://ghproxy.com/https://github.com/nix-community/nixos-vscode-server/archive/master.tar.gz";
    # nur.url = https://ghproxy.com/https://github.com/nix-community/NUR/archive/master.tar.gz;
    nur.url = github:nix-community/NUR;
    # nixos-hardware.url = https://ghproxy.com/https://github.com/NixOS/nixos-hardware/archive/master.tar.gz;
    nixos-hardware.url = "github:NixOS/nixos-hardware";
    catppuccin-starship = {
      url = "https://ghproxy.com/https://github.com/catppuccin/starship/archive/master.tar.gz";
      flake = false;
    };
    catppuccin-alacritty = {
      url = "https://ghproxy.com/https://github.com/catppuccin/alacritty/archive/master.tar.gz";
      flake = false;
    };
    # nix-alien.url = "https://ghproxy.com/https://github.com/thiagokokada/nix-alien/archive/master.tar.gz";
    nix-alien.url = "github:thiagokokada/nix-alien";
  };



  nixConfig = {
    experimental-features = [ "nix-command" "flakes" ];
    substituters = [
      # replace official cache with a mirror located in China
      "https://mirrors.ustc.edu.cn/nix-channels/store"
     "https://cache.nixos.org/"
    ];

    # nix community's cache server
    extra-substituters = [
      "https://nix-community.cachix.org"
    ];
    extra-trusted-public-keys = [
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
    ];
  };

  outputs = { self, nixpkgs, nur, nixos-hardware, home-manager, ... }@inputs: {


    nixosConfigurations.thinkpad = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux"; # or aarch64-linux
      specialArgs = { inherit self; system = "x86_64-linux"; };
      modules = [
        ({ self, system, ... }: {
          environment.systemPackages = with self.inputs.nix-alien.packages.${system}; [
            nix-alien
          ];
          # Optional, needed for `nix-alien-ld`
          programs.nix-ld.enable = true;
        })

        nixos-hardware.nixosModules.common-pc-laptop-ssd
        nixos-hardware.nixosModules.common-gpu-amd

        inputs.vscode-server.nixosModules.default
        ({ config, pkgs, ... }: {
          services.vscode-server.enable = true;
          # services.vscode-server.enableFHS = true;
        })

        home-manager.nixosModules.home-manager
        {
          home-manager.useGlobalPkgs = true;
          home-manager.useUserPackages = true;
          home-manager.users.isidore = import ./home/home.nix;
          home-manager.extraSpecialArgs = inputs;
          nixpkgs.config.allowUnfree = true;
        }
        nur.nixosModules.nur
        #({ config, pkgs, ... }: {
         #environment.systemPackages = [ config.nur.repos.linyinfeng.clash-for-windows ];
         #nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
         #  "clash-for-windows"
         #];
        #})
	./hosts/thinkpad/configuration.nix
        ./modules/system.nix
        ./modules/DWM/gnome.nix
        ./modules/DWM/hyprland.nix
      ];
    };
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux"; # or aarch64-linux
      specialArgs = { inherit self; system = "x86_64-linux"; };
      modules = [
        nixos-hardware.nixosModules.common-pc-laptop-ssd
        nixos-hardware.nixosModules.common-gpu-amd
	      ./hosts/thinkpad/configuration.nix
        ./modules/network.nix
      ];
    };
  };
}

